home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / Snippets / Development Tools & Languages / AEGestalt / UAEGestalt.cp < prev    next >
Encoding:
Text File  |  1995-02-12  |  2.0 KB  |  87 lines  |  [TEXT/MPS ]

  1. //     UAEGestalt.cp 
  2. //     Copyright © 1991-92 by Apple Computer, Inc. All rights reserved.
  3. //    Kent Sandvik DTS
  4. //    This file contains the basic TAEApplication member functions
  5. //
  6. //    <1>        khs        1.0        First final version
  7.  
  8.  
  9. // INCLUDES 
  10.  
  11. #ifndef __UAEGESTALT__
  12. #include "UAEGestalt.h"                                        
  13. #endif
  14.  
  15. // TAEApplication
  16. //    Empty constructor - for avoiding ptabs in global data space
  17.  
  18. #undef Inherited
  19. #define Inherited TApplication
  20.  
  21. #pragma segment ARes
  22. DefineClass(TAEApplication, TApplication);
  23.  
  24. TAEApplication::TAEApplication()
  25. {
  26. }
  27.  
  28. //    Initialize the Application object
  29.  
  30. #pragma segment AInit
  31. void TAEApplication::IAEApplication(OSType fileType,
  32.                                            OSType creator)
  33. {
  34.     Inherited::IApplication(fileType, creator);
  35.  
  36.     // so the linker doesn't dead strip class info 
  37.     macroDontDeadStrip(TLabelView);
  38.     macroDontDeadStrip(TInformationView);
  39.     macroDontDeadStrip(TGrayFill);
  40.  
  41.     // register adorner types
  42.     RegisterStdType("TGrayFill", 'gray');
  43. }
  44.  
  45.  
  46. //    Create a new TDocument from the class
  47. #pragma segment AOpen
  48. TDocument* TAEApplication::DoMakeDocument(CommandNumber/* itsCmdNumber */,
  49.                                                  TFile*/* itsFile */ )
  50. {
  51.     TAEDocument * aAEDocument = new TAEDocument;
  52.     aAEDocument->IAEDocument();
  53.     return aAEDocument;
  54. }
  55.  
  56.  
  57. //    Handle incoming AppleEvents calls, in our case to the TAEServerCommand
  58. #pragma segment ASelCommand
  59. void TAEApplication::DoAppleCommand(CommandNumber theNumber,
  60.                                            const AppleEvent& message,
  61.                                            const AppleEvent& reply)
  62. {
  63.     switch (theNumber)
  64.     {
  65.             // case Gestalt server AE, create a command from the AE, and post it!
  66.         case cAEProvideGestaltInfo:
  67.            {
  68.             TAEServerCommand * aCommand = new TAEServerCommand;
  69.             aCommand->InitializeFromAppleEvent(theNumber, this, kCantUndo, kDoesNotCauseChange, NULL, message, reply);
  70.             this->PostCommand(aCommand);
  71.             break;
  72.             }
  73.  
  74.         default:
  75.             Inherited::DoAppleCommand(theNumber, message, reply);
  76.             break;
  77.     }
  78. }
  79.  
  80.  
  81. // Show our cute About Box with Jeff trying to destroy my portable back home
  82. #pragma segment ARes
  83. void TAEApplication::DoAboutBox()
  84. {
  85.     CreateAboutBox();
  86. }
  87.